import React from 'react';
import { createStackNavigator, CardStyleInterpolators } from '@react-navigation/stack';
import { NavigationContainer } from '@react-navigation/native';
import HomeScreen from '../HomeScreen';
import DetailsScreen from './screens/DetailsScreen';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import FragmentA from './screens/FragmentA';
import FragmentB from './screens/FragmentB';
import {MyStatic} from './components/myStatic';

const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();

const AppNavigator = () => {
    return (
      <NavigationContainer>
        <Stack.Navigator
          screenOptions={{
            headerShown: false, // 隐藏标题栏
            gestureEnabled: true, // 启用手势返回
            cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS, // iOS风格的滑动动画
          }}>
          {/* HomeScreen 跳转到 DetailsScreen */}
          <Stack.Screen name="Home" component={HomeScreen} />
          <Stack.Screen name="Details" component={DetailsScreen} />
          {/* TAB 是 TabNavigator 的入口 */}
          <Stack.Screen name={MyStatic.Tabs} component={TabNavigator} />
        </Stack.Navigator>
      </NavigationContainer>
    );
};
const TabNavigator = () => {
    return (
        <Tab.Navigator screenOptions={{ headerShown: false }}>
            <Tab.Screen name="FragmentA" component={FragmentA} />
            <Tab.Screen name="FragmentB" component={FragmentB} />
        </Tab.Navigator>
    );
};

export default AppNavigator;
